package cn.zxl.spring.holiday.job.service.impl;

import cn.zxl.spring.holiday.job.domain.DictData;
import cn.zxl.spring.holiday.job.mapper.DictDataMapper;
import cn.zxl.spring.holiday.job.service.DictDataService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 字典数据表 服务实现类
 * </p>
 *
 * @author bofeifei
 * @since 2021-10-06
 */
@Service
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements DictDataService {

    @Autowired
    private DictDataMapper dataMapper;

    @Override
    public List<DictData> selectByType(String type) {
        return dataMapper.selectByType(type);
    }

    @Override
    public DictData selectOneByCode(String code) {
        QueryWrapper<DictData> wrapper = new QueryWrapper<>();
        wrapper.eq("dict_code",code);
        return dataMapper.selectOne(wrapper);
    }
}
